
FROM golang:1.17-alpine AS builder


WORKDIR /app


ENV GO111MODULE=on  GOPROXY=https://goproxy.cn,direct GIN_MODE=release


RUN cd


COPY . /app


RUN go mod tidy

RUN cd /app/cmd \
    && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o dy


FROM alpine


COPY --from=builder /app/cmd/ .
COPY --from=builder /app/internal/configs/config.json ./internal/configs/config.json


EXPOSE 8080


ENTRYPOINT ["./dy"]